package algorithm.logic;

import org.junit.Test;

/**
 * @Author: ycy
 * @CreateDate: 2020/9/30 15:52
 */
public class Logfunction {

  public static float logfunction(float srcValue, int max, float threshold) {
    float hot = 0;
    if (Float.compare(srcValue, threshold) >= 0) {
      hot = max;
    } else if (srcValue > 0) {
      double i = max / Math.log10(threshold);
      double v = Math.log10(srcValue);
      hot = (float) (i * v);
    }
    return hot;
  }

  @Test
  public void test3() {

    float aaa = logfunction(0.5f, 100, 5000);
      System.out.println(aaa);

    long x = System.currentTimeMillis();
    for (int i = 0; i < 1000000; i++) {
      int src = i % 5000;
      float logfunction = logfunction(src, 100, 5000);
//      System.out.println(logfunction);
    }
    System.out.println(System.currentTimeMillis() - x);

  }

}
